#创建部署
kubectl create deployment nginx --image=nginx
#暴露端口
kubectl expose deployment nginx --port=80 --type=NodePort
#查看pod以及服务信息
kubectl cluster-info
kubectl get pod,svc

http://192.168.235.128:32698/

#删除节点
kubectl get pods | grep nginx
kubectl describe pods nginx-85b98978db-p7nvj
kubectl exec -it nginx-85b98978db-p7nvj
kubectl get pods -o wide | grep nginx
kubectl delete pod nginx-85b98978db-p7nvj
kubectl delete deploy nginx
kubectl delete svc nginx
kubectl get deploy
kubectl get services

#创建nginx的配置文件
apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
    - image: nginx
      name: nginx
      ports:
        - containerPort: 80

#创建hello-world的配置文件
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: load-balancer-example
  name: hello-world
spec:
  replicas: 5
  selector:
    matchLabels:
      app.kubernetes.io/name: load-balancer-example
  template:
    metadata:
      labels:
        app.kubernetes.io/name: load-balancer-example
    spec:
      containers:
      - image: gcr.io/google-samples/node-hello:1.0
        name: hello-world
        ports:
        - containerPort: 8080

#创建cluster-level-pss的配置文件
mkdir -p /tmp/pss
cat <<EOF > /tmp/pss/cluster-level-pss.yaml
apiVersion: apiserver.config.k8s.io/v1
kind: AdmissionConfiguration
plugins:
- name: PodSecurity
  configuration:
    apiVersion: pod-security.admission.config.k8s.io/v1
    kind: PodSecurityConfiguration
    defaults:
      enforce: "baseline"
      enforce-version: "latest"
      audit: "restricted"
      audit-version: "latest"
      warn: "restricted"
      warn-version: "latest"
    exemptions:
      usernames: []
      runtimeClasses: []
      namespaces: [kube-system]
EOF

#查看路由信息
route -n
#docker 镜像
docker ps

#查看
kubectl get deploy -n  kube-system
kubectl edit deploy -n kube-system nginx
kubectl edit po nginx

kubectl exec nignx-po -it -c nignx -- cat /inited
#探针pod,成功以后（故障恢复【LivenessProbe】，查看服务的就绪状态【ReadinessProbe】），启动探活 StartupProbe

